var fruits = [
    {
        fruitName: '苹果',
        fruitQuantity: 30,
        fruitPrice: 3.8
    },
    {
        fruitName: '西瓜',
        fruitQuantity: 240,
        fruitPrice: 1.8
    },
    {
        fruitName: '芒果',
        fruitQuantity: 60,
        fruitPrice: 7.8
    }
]
let total=0;
// for (let i=0;i<fruits.length;i++){
//     total=total+fruits[i].fruitQuantity*fruits[i].fruitPrice
// }
// console.log(total);

// fruits.forEach(i=>console.log(i));

fruits.forEach(item=>{
    total=total+item.fruitQuantity*item.fruitPrice
})
console.log(total);